$OpenBSD: patch-gnats_getdate_c,v 1.2 2007/12/28 17:11:25 espie Exp $
--- gnats/getdate.c.orig	Tue Feb 20 21:45:43 2001
+++ gnats/getdate.c	Fri Dec 28 18:00:24 2007
@@ -51,6 +51,7 @@
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ctype.h>
 
 #if	defined (vms)
@@ -1225,6 +1226,7 @@ yyerrlab:   /* here on detecting error */
 	{
 	  int size = 0;
 	  char *msg;
+	  size_t msgsize;
 	  int x, count;
 
 	  count = 0;
@@ -1233,10 +1235,11 @@ yyerrlab:   /* here on detecting error */
 	       x < (sizeof(yytname) / sizeof(char *)); x++)
 	    if (yycheck[x + yyn] == x)
 	      size += strlen(yytname[x]) + 15, count++;
-	  msg = (char *) malloc(size + 15);
+	  msgsize = size + 15;
+	  msg = (char *) malloc(msgsize);
 	  if (msg != 0)
 	    {
-	      strcpy(msg, "parse error");
+	      strlcpy(msg, "parse error", msgsize);
 
 	      if (count < 5)
 		{
@@ -1245,9 +1248,10 @@ yyerrlab:   /* here on detecting error */
 		       x < (sizeof(yytname) / sizeof(char *)); x++)
 		    if (yycheck[x + yyn] == x)
 		      {
-			strcat(msg, count == 0 ? ", expecting `" : " or `");
-			strcat(msg, yytname[x]);
-			strcat(msg, "'");
+			strlcat(msg, count == 0 ? ", expecting `" : " or `",
+			    msgsize);
+			strlcat(msg, yytname[x], msgsize);
+			strlcat(msg, "'", msgsize);
 			count++;
 		      }
 		}
